﻿@model Peninsula.DataAccess.POCO.RepairOrder
	@section Scripts{
	}
 <div class="portlet">
	 <div class="portlet-title">
		 <div class="caption">
			 <i class="fa fa-reorder"></i>订单详情
		 </div>
		 <div class="pull-right caption">
			 <a href="@HttpContext.Current.Request.UrlReferrer"  ><i class="fa fa-reply"></i>返回</a>
		 </div>
	 </div>

	<div class="portlet-body ">
		<div class="panel-body">
		   <div class="panel-group" >
			   <label class="col-md-2">
				   @Html.DisplayNameFor(m => m.Name):
			   </label>
			   <div class="col-md-5">
					@Html.DisplayFor(m => m.Name)
			   </div>
			</div>
			<br />
			<hr />
			<div class="form-group-lg">
				<label class="col-md-2">
					@Html.DisplayNameFor(m => m.Description):
				</label>
				<div class="col-md-9">
					@*@Html.DisplayFor(m => m.Description)*@
					@Html.DisplayTextFor(m=>m.Description)
				</div>
				<hr /> 
			</div>
			<br />
			<br />
			<hr /> 
			<div class="panel-group">
				<label class="col-md-2">
					@Html.DisplayNameFor(m => m.Status):
				</label>
				<div class="col-md-7">
				   @Model.Status.EnumDescription()
				</div>
			</div>
			<br />
			<hr /> 
			<div class="panel-group">
				<label class="col-md-2">
					@Html.DisplayNameFor(m => m.Appointment):
				</label>
				<div class="col-md-7">
					@Html.DisplayFor(m => m.Appointment)
				</div>
			</div>
			<br />
			<hr />
			<div class="panel-group">
				<label class="col-md-2">
					@Html.DisplayNameFor(m => m.EndTime):
				</label>
				<div class="col-md-7">
					@{
						if (Model.Status == OrderStatus.RepairFinished || Model.Status == OrderStatus.HhouseholdToGoOut ||
										Model.Status == OrderStatus.AlreadyPaid || Model.Status == OrderStatus.Abandoned)
						{
							@Html.DisplayFor(m => m.EndTime)

						}
						else if (Model.Status == OrderStatus.Received || Model.Status == OrderStatus.Sent
						   || Model.Status == OrderStatus.OnTheWay)
						{
							<p>订单维修中</p>
						}
						else
						{
							<p>订单未接取</p>
						}

					}
				</div>
			</div>
			<br />
			<hr />
			<div class="panel-group">
				<label class="col-md-2">
					@Html.DisplayNameFor(m => m.ItemTypeId):
				</label>
				<div class="col-md-7">
				   @Model.ItemType.Name
				</div>
			</div>
			<br />
			<hr />
			<div class="panel-group">
				<label class="col-md-2">
					@Html.DisplayNameFor(m => m.Price):
				</label>
				<div class="col-md-7">
					@{
						if (Model.Status == OrderStatus.AlreadyPaid)
						{
							@Html.DisplayFor(m => m.Price)<p>（已付款）</p>
						}
						else if (Model.Status == OrderStatus.RepairFinished)
						{
							@Html.DisplayFor(m => m.Price)<p>（未付款）</p>
						}
						else if (Model.Status == OrderStatus.HhouseholdToGoOut)
						{
							<p>户主外出，并未维修</p>
						}
						else if (Model.Status == OrderStatus.Submitted)
						{
							<p>订单未被接取</p>
						}
						else
						{
							<p>订单未维修完成</p>
						}
					}
				</div>
			</div>
			<br />
			<hr /> 
			<div class="panel-group">
				<label class="col-md-2">
					@Html.DisplayNameFor(m => m.StoreId):
				</label>
				<div class="col-md-7">
					@{
						if (Model.Status == OrderStatus.Submitted)
						{
							<p>订单未被接取</p>
						}
						else
						{
							@Model.Store.Name
						}
					}
				</div>
			</div>
			<br />
			<hr />
			<div class="panel-group">
				<label class="col-md-2">
					@Html.DisplayNameFor(m => m.MaintenanceStaffId):
				</label>
				<div class="col-md-7">
					@{
						if (Model.Status == OrderStatus.Submitted)
						{
							<p>订单未被接取</p>
						}
						else if (Model.MaintenanceStaffId.IsNullOrEmpty())
						{
							<p>订单未被派遣</p>
						}

						else
						{
							@Model.MaintenanceStaff.TrueName
						}
					}
				</div>
			</div>
			<br />
			<hr /> 
			<div class="panel-group">
				<label class="col-md-2">
					@Html.DisplayNameFor(m => m.MMessage):
				</label>
				<div class="col-md-7">
					@{
						if (Model.Status == OrderStatus.Submitted)
						{
							<p>订单未被接取</p>
						}
						else if (Model.MMessage.IsNullOrEmpty())
						{
							<p>维修人员未留言</p>
						}
						else
						{
							@Model.MMessage
						}
					}
				</div>
			</div>
			<br />
			<hr /> 
			<div class="panel-group">
				<label class="col-md-2">
					@Html.DisplayNameFor(m => m.SiteFiles):
				</label>
				<div class="col-md-7 " style="margin:0 auto;text-align:center">
				  
					@*<asp:DataList ID="DataList1" runat="server" Width="100%" Height="100%" RepeatColumns="4" RepeatDirection="Horizontal">
						<ItemTemplate>*@
							<table class="table  table-bordered k">
								@foreach (var item in Model.SiteFiles)
								{
									<tr>
										<td>
										  
											<img src="@Url.Content(item.Path)" width="500px" height="350" class="center-block" />
										</td>
									</tr>
								}
								
								@{
								 
 
								 @*IQueryable<SiteFile> strImgs = Model.SiteFiles  as IQueryable<SiteFile>;
 
									if (strImgs != null)
									{
									   List<SiteFile> strs = strImgs.ToList();
									   //得到条数
									   int count=strs.Count;
									   //得到余数
									  int yu=count%4;
									   //得到整数部分
									   int tiao = count - yu;

									  //循环开始（外部循环为行数据;内部循环为列数据（这里共4列））
									   for (int i = 0; i < count; )
									 {
										//加的条数
										 int t = 4;
										  if (yu > 0 && i == tiao)
											  { t = yu; }
										  <tr>
											 @for (int j = 0; j <t; j++)
											 {
											  <td><img src='@Url.Content( strs[i + j].Path)'/></td>
											 }
										  </tr>
										   //最后一次循环，加余数，保证index正常
										  if (i == tiao)
										 { i += yu; }
										  else
										   { i += 4;}
										}

								   }*@
				 }
							</table>
						@*</ItemTemplate>
					</asp:DataList>*@
				</div>
			</div>
		</div>
	</div>
 </div>
